package com.newbingo.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
import com.newbingo.domain.common.EntitySupport;
import com.newbingo.domain.common.Identity;

/**
 * GameTable Entity
 */

@Entity
@Table(name = "GameTable")
public class GameTable implements Serializable {
	@Identity
	private Integer gtno;
	private String name;
	private String website;
	private String status;
	private GameOperationTime operationTime;
	private PeriodGame currentPeriodGame;
	private Game game;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "gtno")
	public Integer getGtno() {
		return gtno;
	}

	public void setGtno(Integer gtno) {
		this.gtno = gtno;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Embedded()
	public GameOperationTime getOperationTime() {
		return operationTime;
	}

	public void setOperationTime(GameOperationTime operationTime) {
		this.operationTime = operationTime;
	}

	@OneToOne(cascade = CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name = "currentPeriodGame")
	public PeriodGame getCurrentPeriodGame() {
		return currentPeriodGame;
	}

	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	public void setCurrentPeriodGame(PeriodGame currentPeriodGame) {
		this.currentPeriodGame = currentPeriodGame;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "gameno")
	public Game getGame() {
		return game;
	}

	public void setGame(Game game) {
		this.game = game;
	}

}
